<%-- 
    Document   : selectChoiceProcess
    Created on : 6 Apr, 2010, 12:03:25 PM
    Author     : Praveen Kumar
--%>

<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.sql.*"%>
<%@page language="java" import="java.util.*"%>
<%@page import="java.*" %>


<%          String stSuid = (String) session.getAttribute("suid");
out.println(stSuid);
            //String bt = (String) session.getAttribute("bt");
            //String stSuid = request.getParameter("suid");
            String bt = request.getParameter("bt");
            String che = request.getParameter("che");
            String civ = request.getParameter("civ");
            String cse = request.getParameter("cse");
            String ece = request.getParameter("ece");
            String ee = request.getParameter("ee");
            String it = request.getParameter("it");
            String mec = request.getParameter("mec");
            String mme = request.getParameter("mme");

            Connection connection = null;
            try {

                String driverName = "oracle.jdbc.driver.OracleDriver";
                Class.forName(driverName);

                // Create a connection to the database
                String serverName = "10.0.0.27";
                String portNumber = "1521";
                String sid = "XE";
                String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
                String uname = "aranya27";
                String pword = "doodledo";

                connection = DriverManager.getConnection(url, uname, pword);


                // enter code here

                Statement st = null;
                st = connection.createStatement();
                String str = "insert into aranya27.student_branch_choices values (" + stSuid + "," + bt + "," + che + "," + civ + "," + cse + "," + ece + "," + ee + "," + it + "," + mec + "," + mme + ")";

                out.println(str);
                st.executeUpdate(str);

                Statement st1 = null;
                st1 = connection.createStatement();
                String str1 = "update aranya27.test_allot set flag=1 where suid=" + stSuid;
                out.println(str1);
                st1.executeUpdate(str1);

                session.setAttribute("suid", stSuid);
                connection.close();
                response.sendRedirect("studentHome.jsp");
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
                System.out.println(" Could not find the database driver");
            } catch (SQLException e) {
                e.printStackTrace();
                System.out.println("Could not connect to the database");
            }



%>